package www.xpu.edu.app;

import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class Activity_test extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test);
        ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.hide();
        }
        TextView text=findViewById(R.id.test_text);
        TextView text2=findViewById(R.id.title_text);
        text2.setText("西安工程大学2019校招");
        text.setText(getIntent().getStringExtra("data"));


        final String data1 = getIntent().getStringExtra("data1");
        final String data2 = getIntent().getStringExtra("data2");
        final long time=System.currentTimeMillis()+24*60*60*1000;
        CalendarReminderUtils.addCalendarEvent(Activity_test.this,data1+"的宣讲会",data2,time,1);



        Button button1=(Button)findViewById(R.id.title_back);
        button1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        Button button2=(Button)findViewById(R.id.title_change);
        Button button3=(Button)findViewById(R.id.test_button);
        button2.setVisibility(View.GONE);
        /*
         //24*60*60*1000
        long l = System.currentTimeMillis()+100000;
        CalendarReminderUtils.addCalendarEvent(MainActivity.this,"西安工程大学招聘","测试内容：明天下午来西安工程大学参加宣讲会",l,1);

         */
        button3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //最后一个参数是提前多少天会有提醒
                //已经修改为提前多少小时提醒
                CalendarReminderUtils.addCalendarEvent(Activity_test.this,data1+"的宣讲会",data2,time,1);
                Toast.makeText(Activity_test.this,"成功添加到系统日历的提醒日程中,宣讲会召开一小时前会有提醒",Toast.LENGTH_LONG).show();
                //Toast.makeText(Activity_test.this,"添加到日期提醒的功能正在开发中",Toast.LENGTH_LONG).show();
            }
        });

    }
}
